<?php



namespace App\Http\Requests\ApiV2;

use Carbon\Carbon;
use Illuminate\Support\Facades\Auth;

class DistrictRequest extends BaseRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'name' => 'required',
            'longitude' => 'required',
            'latitude' => 'required',
            'province' => 'required|max:20',
            'city' => 'required|max:20',
            'address' => 'required|max:20',
            'cover' => 'required|max:169',
        ];
    }

    public function messages()
    {
        return [
            'name.required' => __('请输入姓名'),
            'longitude.required' => __('请输入经度'),
            'latitude.required' => __('请输入纬度'),
            'address.required' => __('请输入详细地址'),
            'province.required' => __('请输入省份'),
            'city.required' => __('请输入城市'),
            'cover' => __('请输入小区封面'),

        ];
    }

    public function filldata()
    {
        return [
            'user_id' => Auth::id(),
            'name' => $this->input('name'),
            'longitude' => $this->input('longitude'),
            'latitude' => $this->input('latitude'),
            'address' => $this->input('address'),
            'province' => $this->input('province'),
            'city' => $this->input('city'),
            'cover' =>$this->input('cover'),


        ];
    }
}
